<!DOCTYPE html>
<html class="no-js" lang="">

<head>
    #include( "/public-head.html")
</head>

<body style="background-color: #ffffff !important;">
<!-- main area -->
<div class="main-content checkbo">
    <div class="panel mb25">
        <div class="panel-heading border">
            #if($!{video.videoId}) 修改#else 添加#end视频
        </div>
        <div class="panel-body">
            <div class="row no-margin">
                <div class="col-lg-12">
                    <form action="/vrs/video/edit.jsn" method="get" data-url="/vrs/video/golist.html" id="commentForm" name="ajaxForm" class="form-horizontal bordered-group" role="form">
                        <!--<input name="video.isdisplay" value="0" class="hidden" />-->
                        <input  name="video.liveDetail" value="$!{video.liveDetail}"class="hidden" >
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频id</label>
                            <div class="col-sm-10">
                                <input type="text" name="video.videoId"  value="$!{video.videoId}" class="hidden" >
                                <input type="text"  class="form-control w100" value="$!{video.videoId}" placeholder="视频id" disabled="">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属专辑<code>*</code></label>
                            <div class="col-sm-10">
                                <select id="albumSelect" required data-placeholder="请选择专辑" class="chosen w400" name="video.album.albumId">
                                    <option value=""></option>
                                    #if($albumList)
                                        #foreach( $row in $!{albumList})
                                        <option value="$!{row.albumId}">$!{row.name}</option>
                                        #end
                                    #end
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频名称<code>*</code></label>
                            <div class="col-sm-10">
                                <input type="text" id="videoName" required name="video.name" value="$!{video.name}" class="form-control w250" placeholder="视频名称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频副名称</label>
                            <div class="col-sm-10">
                                <input type="text"  name="video.subName" value="$!{video.subName}" class="form-control w250" placeholder="视频副名称">
                            </div>
                        </div>

                        <textarea id="standardPic" name="video.standardPic" rows="5" cols="100" class="hidden">$!{video.standardPic}</textarea>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频配图<code>*</code></label>
                            <div id="picDiv" class="col-sm-10" data-theme-name="upload-image">

                                <div  data-theme-name="upload-image-div" class="pull-left" >
                                    <div class="pull-left mr10">
                                        <select data-placeholder="请选择终端" required data-theme-name="terminal"  class="chosen w100" >
                                            <option value="3">Mobile</option>
                                            <option value="1">TV&OTT</option>
                                            <option value="2">PC</option>
                                            <option value="4">pad</option>
                                        </select><br/>
                                        <button type="button" class="btn btn-danger" data-theme-name="remove-upload-image" >删除</button>
                                    </div>
                                    <div class="pull-left mr10">
                                        <!--<img src="/images/upload_1242x416.jpg" width="248" height="82">-->
                                        <label data-theme-name="upload-image-label">
                                            <img src="/images/upload_1242x416.jpg" name="" data-theme-name="view-image" width="248" height="82">
                                            <img src="/images/wait.gif" width="40" height="40" data-theme-name="wait-image" >
                                            <input type="file"  name="image"  />
                                            <input name="root" value="album" style="display: none"  />
                                        </label>
                                    </div>
                                </div>
                                <div class="pull-left mr10">
                                    <button type="button" class="btn btn-primary" data-theme-name="add-upload-image" >添<br/>加</button>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频类型<code>*</code></label>
                            <div id="videoTypeRadio" class="col-sm-10" data-theme-name="video-type-div">
                                <label class="cb-radio">
                                    <input type="radio" required name="video.videoType" value="1" />正片
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.videoType" value="2" />单曲
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.videoType" value="3" />花絮
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.videoType" value="4" />直播
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.videoType" value="5" />秀场
                                </label>
                            </div>
                        </div>
                        <!--上传视频组件-->
                        <div class="form-group" data-theme-name="upload-video-div" >
                            <label class="col-sm-2 control-label">上传视频<code>*</code></label>
                            <div class="col-sm-10">
                                <label id="uploadVideoLabel" data-theme-name="upload-video-label" data-url="/vrs/api/getUploadVideoUrl.jsn">
                                    <img src="/images/upload_1920x1080.jpg" data-theme-name="view-image" width="192" height="108">
                                    <img src="/images/wait.gif" width="40" data-theme-name="wait-image" height="40" >
                                    <!--<img src="/images/upload_end.png" data-theme-name="end-image"  width="192" height="108">-->
                                    <span>0%</span>
                                    <input type="file" name="video_file" />
                                </label>
                            </div>
                        </div>
                        <!--上传视频组件-->
                        <!--手动输入直播源组件-->
                        <input id="sourceInput" class="hidden" type="text" name="video.source"  value="$!{video.source}" />
                        <input id="activityId" name="video.liveActivityId" value="$!{video.liveActivityId}" class="form-control w150 activityId hidden" placeholder="活动ID">
                        <div class="form-group " data-theme-name="create-live">
                            <label class="col-sm-2 control-label">活动id<code>*</code></label>
                            <div class="col-sm-10 activityId" >
                                #if($!{video.liveActivityId}) $!{video.liveActivityId}#else 未生成#end
                            </div>
                         </div>
                        <div class="form-group " data-theme-name="create-live">
                            <label class="col-sm-2 control-label">舞台及id</label>
                            <div class="col-sm-10">
                                <table id="sourceTable" class="table table-bordered bordered table-striped table-condensed vrs-table" data-url="golist.html"><!--datatable-->
                                    <thead>
                                    <tr>
                                        <th>舞台</th>
                                        <th>直播id</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group" data-theme-name="live-video-div">
                            <label class="col-sm-2 control-label">舞台<code>*</code></label>
                            <div class="col-sm-7">
                                <input id="stageNamesInput" class="tags" type="text" name="video.stageNames" value="$!{video.stageNames}" />

                            </div>

                        </div>
                        <div class="form-group" data-theme-name="live-video-div">
                            <label class="col-sm-2 control-label">是否需要鉴权</label>
                            <div id="isNeedPushAuth" class="col-sm-10">
                                <label class="cb-radio">
                                    <input type="radio" name="isNeedPushAuth" value="1" />需要
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" name="isNeedPushAuth" checked value="0" />不需要
                                </label>
                            </div>

                        </div>
                        <div class="form-group" data-theme-name="live-video-div">
                            <label class="col-sm-2 control-label"></label>
                            <div class="col-sm-10">
                                <button type="button" id="createActivity" class="btn btn-primary mr10 createActivity">#if($!{video.liveActivityId}) 修改直播#else 生成直播#end</button>
                                <span class="error-span" >*点击"生成直播"前，请确认舞台，视频名称，开始结束时间已经正确填写</span>
                            </div>

                        </div>
                        <!--手动输入直播源组件-->
                        <!--程序控制上下线是否显示-->
                        <div class="form-group isdisplay" data-theme-name="live-video-div"  >
                            <label class="col-sm-2 control-label">是否上线</label>
                            <div id="isDisplayRadio" class="col-sm-10">
                                <label class="cb-radio">
                                    <input type="radio" name="video.isdisplay" value="1" />上线
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" name="video.isdisplay" value="0" />下线
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" name="video.isdisplay" checked value="2" />处理中
                                </label>
                            </div>
                            <label class="col-sm-2 control-label"></label>
                            <div class="col-sm-10">
                                <span class="error-span" >*此处只有在编辑直播类视频时，编辑可操作上下线两个按钮，其他情况均有程序控制</span>
                            </div>
                        </div>
                        <!--程序控制上下线是否显示-->
                        <!--时间-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">开始时间<code>*</code></label>
                            <div class="col-sm-9">
                                <div class="pull-left " style="margin-right: 20px;">
                                    <input id="showTime" required type="text" class="form-control mb25 w200 vrs-date" value="$!{video.showTime}" data-theme-name="time" data-provide="datepicker" >
                                    <input  type="text"  class="hidden vrs-date-submit" value="$!{video.showTime}"   name="video.showTime" >
                                </div>
                                <div class="pull-left">
                                    <div class="input-group input-group-lg clockpicker w200" style="float: left">
                                        <input type="text" class="form-control vrs-time" required value="">
                                        <span class="input-group-addon">
                                            <span class="fa fa-clock-o"></span>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">结束时间<code>*</code></label>
                            <div class="col-sm-9">
                                <div class="pull-left " style="margin-right: 20px;">
                                    <input id="endTime" required type="text" class="form-control mb25 w200 vrs-date" value="$!{video.endTime}" data-theme-name="time"  data-provide="datepicker" style="">
                                    <input  type="text"  class="hidden vrs-date-submit" value="$!{video.endTime}"   name="video.endTime" >
                                </div>
                                <div class="pull-left">
                                    <div class="input-group input-group-lg clockpicker w200" style="float: left">
                                        <input type="text" class="form-control vrs-time" required value="">
                                        <span class="input-group-addon">
                                            <span class="fa fa-clock-o"></span>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--时间-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否需要支付<code>*</code></label>
                            <div id="isNeedPayRadio" class="col-sm-10">
                                <label class="cb-radio">
                                    <input type="radio" required name="video.isNeedPay" value="1" />需要
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.isNeedPay" value="0" />不需要
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">视频来源<code>*</code></label>
                            <div id="sourcefromRadio" class="col-sm-10">
                                <label class="cb-radio">
                                    <input type="radio" required name="video.sourcefrom" value="0" />CIBN
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.sourcefrom" value="1" />乐视
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.sourcefrom" value="2" />第一视频
                                </label>
                                <label class="cb-radio">
                                    <input type="radio" required name="video.sourcefrom" value="3" />测试
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">艺人<code>*</code></label>
                            <div class="col-sm-10">
                                <select id="starrSelect" required data-placeholder="请选择艺人"  multiple class="chosen" name="video.starringIds" style="width: 60%;">
                                    <option value=""></option>
                                    #if($starringList)
                                    #foreach( $row in $!{starringList})
                                    <option value="$!{row.starringId}">$!{row.name}</option>
                                    #end
                                    #end
                                </select>
                            </div>
                        </div>

                        <!--<div class="form-group">
                            <label class="col-sm-2 control-label">结束时间</label>
                            <div class="col-sm-9">
                                <div class="pull-left " style="margin-right: 20px;">
                                    <input type="text" class="form-control mb25 w200 vrs-date"  name="" data-provide="datepicker" style="">
                                </div>
                                <div class="pull-left">
                                    <div class="input-group input-group-lg clockpicker w200" style="float: left">
                                        <input type="text" class="form-control vrs-time"  value="">
                                        <span class="input-group-addon">
                                            <span class="fa fa-clock-o"></span>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>-->

                        <div class="form-group">
                            <label class="col-sm-2 control-label">标签<code>*</code></label>
                            <div class="col-sm-10">
                                <input id="tag" type="text" required class="tags" name="video.tag"  value="$!{video.tag}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">简介</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" id="description"  name="video.description" rows="3">$!{video.description}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label></label>
                            <div>
                                <button type="button" class="btn btn-primary mr10 submit">#if($!{video.videoId}) 修改#else 添加#end</button>
                                <button class="btn btn-default">返回</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


</div>
<!-- /main area -->

#include( "/public-script.html")
#include( "/sub-script.html")
<script src="/scripts/ajax/ajax.livevideo.js"></script>
<script>
    $("#starrSelect").chosen({
        search_contains:true
    });
    //单选
    initEditSelect('albumSelect','$!{video.album.albumId}');
    initVideoStarr($('#albumSelect'),'starrSelect','$!{video.starringIds}');
    //多选
    //initEditSomeSelect('starrSelect','$!{video.starringIds}');
    //radio
    initEditRadio('isNeedPushAuth','0');
    initEditRadio('videoTypeRadio','$!{video.videoType}')
    initEditRadio('isNeedPayRadio','$!{video.isNeedPay}')
    initEditRadio('sourcefromRadio','$!{video.sourcefrom}')
    initEditRadio('isDisplayRadio','$!{video.isdisplay}')

    //输入框
    //initEditInput('tags','$!{album.tag}')
    //配图
    initEditPic('picDiv','$!{video.standardPic}')
    //initEditStarrData('starrPicDiv','$!{album.starringInfo}')
    //格式化时间
    initEditTime('showTime','$!{video.showTime}')
    initEditTime('endTime','$!{video.endTime}')


    //如果是视频类型就做处理
    var $uploadVideoDiv = $('div[data-theme-name="upload-video-div"]');
    var $liveVideoDiv = $('div[data-theme-name="live-video-div"]');
    var $createVideoDiv = $('div[data-theme-name="create-live"]');
    var videoType = '$!{video.videoType}';
    if (videoType == '4' || videoType == '5') {
        $uploadVideoDiv.hide()
        $liveVideoDiv.show()
        $createVideoDiv.show()
    } else {
        $createVideoDiv.hide()
        $liveVideoDiv.hide()
        $uploadVideoDiv.show()
        //初始化视频类型
        initEditVideoPic('uploadVideoLabel','$!{video.source}')
    }

    //选择专辑后
    $('#albumSelect').change(function(){
        var $this = $(this);
        initVideoStarr($this,'starrSelect');
    });



</script>
</body>

</html>
